 {include file="public/layout" /}
<script type="text/javascript" src="__SKIN__/js/clipboard.min.js"></script>
<body class="bodystyle" style="cursor: default; -moz-user-select: inherit;">
<div id="append_parent"></div>
<div id="ajaxwaitid"></div>
<div class="page">
    <div class="fixed-bar">
        <div class="item-title">
            <a class="back_xin" href="{:url('Weapp/index')}" title="返回"><i class="iconfont e-fanhui"></i></a>
            <div class="subject">
                <h3>网站设置</h3>
                <h5></h5>
            </div>
        </div>
    </div>
    <form method="post" id="handlepost" action="{:url('System/web')}" enctype="multipart/form-data" name="form1">
        <div class="ncap-form-default">
            <dl class="row">
                <dt class="tit">
                    <label for="web_title">首页标题</label>
                </dt>
                <dd class="opt ui-web_title ui-text">
                    <input id="web_title" name="web_title" value="{$config.web_title|default=''}" class="input-txt ui-input" type="text" data-num="80" />
                    <p class="notic">一般不超过80个字符</p>
                    <p class="ui-big-text none">一般不超过80个字符（<span class="ui-textTips">还可以输入80个字符</span>）</p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_title</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_title');" class="ui-btn3 blue web_title" data-clipboard-text="{literal}{eyou:global name='web_title' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_keywords">首页关键词</label>
                </dt>
                <dd class="opt ui-keyword ui-text">
                    <input id="web_keywords" name="web_keywords" value="{$config.web_keywords|default=''}" class="input-txt ui-input" type="text" data-num="100" />
                    <p class="notic">一般不超过100个字符</p>
                    <p class="ui-big-text none">一般不超过100个字符（<span class="ui-textTips">还可以输入100个字符</span>）</p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_keywords</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_keywords');" class="ui-btn3 blue web_keywords" data-clipboard-text="{literal}{eyou:global name='web_keywords' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_description">首页描述</label>
                </dt>
                <dd class="opt ui-web_description ui-text">
                    <textarea rows="5" cols="60" id="web_description" name="web_description" style="height:60px;" class="ui-input" data-num="200">{$config.web_description|default=''}</textarea>
                    <p class="notic">建议不超过200个字符</p>
                    <p class="ui-big-text none">建议不超过200个字符（<span class="ui-textTips">还可以输入200个字符</span>）</p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_description</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_description');" class="ui-btn3 blue web_description" data-clipboard-text="{literal}{eyou:global name='web_description' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_recordnum">备案号</label>
                </dt>
                <dd class="opt ui-keyword">
                    {eq name='$config.web_recordnum_mode' value='1'}
                        <textarea rows="5" cols="60" id="web_recordnum" name="web_recordnum" class="h40">{$config.web_recordnum|default=''}</textarea>
                    {else /}
                        <textarea rows="5" cols="60" id="web_recordnum" name="web_recordnum" class="h20">{$config.web_recordnum|htmlspecialchars_decode|strip_tags}</textarea>
                    {/eq}
                    <input type="hidden" id="web_recordnum_mode" name="web_recordnum_mode" value="{$config.web_recordnum_mode|default='0'}">
                    &nbsp;[<a href="javascript:void(0);" onclick="show_recordnum(this);">{eq name='$config.web_recordnum_mode' value='
                    1'}普通模式{else /}代码模式{/eq}</a>]
                    <p class="notic"></p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_recordnum</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_recordnum');" class="ui-btn3 blue web_recordnum" data-clipboard-text="{literal}{eyou:global name='web_recordnum' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_garecordnum">公安备案号</label>
                </dt>
                <dd class="opt ui-keyword">
                    {eq name='$config.web_garecordnum_mode' value='1'}
                        <textarea rows="5" cols="60" id="web_garecordnum" name="web_garecordnum" class="h40">{$config.web_garecordnum|default=''}</textarea>
                    {else /}
                        <textarea rows="5" cols="60" id="web_garecordnum" name="web_garecordnum" class="h20">{$config.web_garecordnum|htmlspecialchars_decode|strip_tags}</textarea>
                    {/eq}
                    <input type="hidden" id="web_garecordnum_mode" name="web_garecordnum_mode" value="{$config.web_garecordnum_mode|default='0'}">
                    &nbsp;[<a href="javascript:void(0);" onclick="show_garecordnum(this);">{eq name='$config.web_garecordnum_mode' value='
                    1'}普通模式{else /}代码模式{/eq}</a>]
                    <p class="notic"></p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_garecordnum</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_garecordnum');" class="ui-btn3 blue web_garecordnum" data-clipboard-text="{literal}{eyou:global name='web_garecordnum' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row"><dt class="tit"><label><b>网站第三方代码</b></label></dt></dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_thirdcode_pc">电脑PC端</label>
                </dt>
                <dd class="opt">
                    <textarea rows="5" cols="60" id="web_thirdcode_pc" name="web_thirdcode_pc" style="height:80px;">{$config.web_thirdcode_pc|default=''}</textarea>
                    <p class="notic">代码会放在 &lt;/body&gt; 标签以上（一般用于放置百度商桥代码、站长统计代码、谷歌翻译代码等）</p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_thirdcode_pc</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_thirdcode_pc');" class="ui-btn3 blue web_thirdcode_pc" data-clipboard-text="{literal}{eyou:global name='web_thirdcode_pc' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <dl class="row">
                <dt class="tit">
                    <label for="web_thirdcode_wap">手机移动端</label>
                </dt>
                <dd class="opt">
                    <textarea rows="5" cols="60" id="web_thirdcode_wap" name="web_thirdcode_wap" style="height:80px;">{$config.web_thirdcode_wap|default=''}</textarea>
                    <p class="notic">代码会放在 &lt;/body&gt; 标签以上（一般用于放置百度商桥代码、站长统计代码、谷歌翻译代码等）</p>
                </dd>
                {eq name="$web_cmsmode" value="2"}
                <dd class="variable">
                    <div><p>web_thirdcode_wap</p></div>
                    <div class="r"><a href="javascript:void(0);" onclick="showtext('web_thirdcode_wap');" class="ui-btn3 blue web_thirdcode_wap" data-clipboard-text="{literal}{eyou:global name='web_thirdcode_wap' /}{/literal}">复制标签</a></div>
                </dd>
                {/eq}
            </dl>
            <div class="bot">
                <a href="JavaScript:void(0);" class="ncap-btn-big ncap-btn-green" onclick="adsubmit();">确认提交</a>
            </div>
        </div>
    </form>
</div>
<script type="text/javascript">

    $(function(){
        tipsText();
    });

    function adsubmit(){
        layer_loading("正在处理");
        $('#handlepost').submit();
    }

    function showtext(classname){
        var clipboard1 = new Clipboard("."+classname);clipboard1.on("success", function(e) {layer.msg("复制成功");});clipboard1.on("error", function(e) {layer.msg("复制失败！请手动复制", {icon:5});}); 
    }
    
    function show_recordnum(obj)
    {
        var recordnumObj = $('#web_recordnum');
        var value = recordnumObj.val();
        var valuehtml = "";

        if (value.indexOf('&lt;/a&gt;') == -1) {
            valuehtml = '<a href="https://beian.miit.gov.cn/" rel="nofollow" target="_blank">'+value+'</a>';
        }

        var web_recordnum_mode = $('#web_recordnum_mode').val();
        if (web_recordnum_mode == 0) { // 切换为代码模式
            $('#web_recordnum_mode').val(1);
            $(obj).html('普通模式');
            recordnumObj.css('height', '40px');
            recordnumObj.val(valuehtml);
        } else { // 切换为普通模式
            $('#web_recordnum_mode').val(0);
            $(obj).html('代码模式');
            recordnumObj.css('height', '20px');
            recordnumObj.val(removeHTMLTag(value));
        }
    }
    
    function show_garecordnum(obj)
    {
        var gaRecordnumObj = $('#web_garecordnum');
        var value = gaRecordnumObj.val();
        var valuehtml = "";

        if (value.indexOf('&lt;/a&gt;') == -1) {
            var recordcode = value.replace(/([^\d\-]+)/g, '');
            valuehtml = '<a href="http://www.beian.gov.cn/portal/registerSystemInfo?recordcode='+recordcode+'" rel="nofollow" target="_blank">'+value+'</a>';
        }

        var web_garecordnum_mode = $('#web_garecordnum_mode').val();
        if (web_garecordnum_mode == 0) { // 切换为代码模式
            $('#web_garecordnum_mode').val(1);
            $(obj).html('普通模式');
            gaRecordnumObj.css('height', '40px');
            gaRecordnumObj.val(valuehtml);
        } else { // 切换为普通模式
            $('#web_garecordnum_mode').val(0);
            $(obj).html('代码模式');
            gaRecordnumObj.css('height', '20px');
            gaRecordnumObj.val(removeHTMLTag(value));
        }
    }

    //过滤HTML标签
    function removeHTMLTag(str) {
        str = str.replace(/<\/?[^>]*>/g, ''); //去除HTML tag
        str = str.replace(/[ | ]*\n/g, '\n'); //去除行尾空白
        str = str.replace(/ /ig, ''); //去掉 
        return str;
    }

</script>

{include file="public/footer" /}